home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 001a / com_and3.zip / INDIR.CMD < prev    next >
OS/2 REXX Batch file  |  1989-10-09  |  3KB  |  70 lines

  1. ; ----- INDIR: Load the dialing directory from an ASCII file
  2. ; ----------------------------------------------------------------
  3. ;    Note: This script expects the file DIALING.TXT to be an ASCII file
  4. ;    of a specific format, carrying dialing directory entries.  Records
  5. ;    are structured:
  6. ;
  7. ;  Col: 0          38            57              61
  8. ;    +-----+-/ /-+-----+-----+-/ /-+-----+-----+-/ /-+-----+-//
  9. ;    !  Entry name      !  Phone number   ! Speed          !
  10. ;    +-----+-/ /-+-----+-----+-/ /-+-----+-----+-/ /-+-----+-//
  11. ;         !           !             +--------- 4 chars
  12. ;         !           +--------------------------- 14 chars
  13. ;         +--------------------------------------------- 24 chars
  14. ;
  15. ;  Col:       61    62      63    64    65    66      67    68    69    70
  16. ;          +-----+-----+-----+-----+-----+-----+-----+-----+-----+-//
  17. ;          !     !  P  !    !  D  !     !  S  !    !  E  !     !
  18. ;          +-----+-----+-----+-----+-----+-----+-----+-----+-----+-//
  19. ;               !       !           !       +--- Echo Y/N
  20. ;               !       !           +--------------- Stop 1/2
  21. ;               !       +--------------------------- Data 7/8
  22. ;               +--------------------------------------- Parity E/N/O
  23. ;
  24. ;  Col:       70        78
  25. ;          +-----+-/ /-+-----+
  26. ;          ! Script file    !
  27. ;          +-----+-/ /-+-----+
  28. ;               +--------------------------------------- 8 chars
  29. ;
  30. ; ----------------------------------------------------------------
  31. ;    Only the first 100 records in DIALING.TXT are used.  Blank records
  32. ;    result in an empty directory entry.
  33. ; ----------------------------------------------------------------
  34. ;    The long distance portion of the dialing directory is copied
  35. ;    from the file COM-AND.DIR (which must be present).
  36. ; ----------------------------------------------------------------
  37. ;
  38. ;    Move the header with no changes
  39. ;
  40.     LEGEND "InDir: Dialing directory update"
  41.     FOPENI "COM-AND.DIR" BINARY
  42.     FOPENO "NCOM-AND.DIR" BINARY
  43.  
  44.     READ  S0 80 N0
  45.     WRITE S0 80
  46.     READ  S0 70 N0
  47.     WRITE S0 70
  48. ;
  49. ;    Now, read the input file and update the directory
  50. ;
  51.     FOPENI "Dialing.TXT" Text
  52.     FOR N0 = 1,100            ; Do 100 times
  53.         LEGEND "InDir: Entry # "*N0*" output"
  54.         READ S0 80 N1
  55.         IF EOF or NULL S0
  56.            S0(0:39)  = "........................              .-"
  57.            S0(40:79) = "...-....         1200,E,7,1,N         "
  58.            ENDIF
  59.         S1 = S0(0:23)        ; Name     (24 chars and a null)
  60.         S1(25:79) = S0(38:52)    ; Number (14 chars and a null)
  61.         S1(40:79) = S0(57:61)    ; Speed  (4 chars and a null)
  62.         S1(45:79) = " "*S0(62)*S0(64)*S0(66)*S0(68)*" " ; Parms (6 wide)
  63.         S1(51:79) = S0(70:77)    ; Script (8 Chars and a null)
  64.         ITOC 0 S1(24)        ; Null stoppers
  65.         ITOC 0 S1(39)
  66.         ITOC 0 S1(44)
  67.         ITOC 0 S1(59)
  68.         WRITE S1 60         ; Each entry is 60 wide with embedded
  69.         ENDFOR
  70.